#include <iostream>

using namespace std;

class Solution
{
public:
    int countGoodSubstrings(string s)
    {
        int a, b = 0;
        int cnt = 0;
        for (int i = 2; i < s.size(); i++)
        {
            if (s[i] != s[i - 1] && s[i] != s[i - 2] &&
                s[i - 1] != s[i - 2])
            {
                cnt++;
            }
        }
        return cnt;
    }
};

int main()
{
	string s{ "xyzzaz" };
    Solution xz;
    int n = xz.countGoodSubstrings(s);
    cout << n << endl;


	return 0;
}